Hello everyone.
In this lecture we will learn about macros in Excel but first what is a macro macro is a set of programming
instructions stored as a procedure which means it is just a bit of code which contains sequence of actions.
These actions could be used based on keyboard or mouse clicks and whenever you will run the score all
the actions will be performed in the Excel sheet.
So for example I already have this macro saved which bought centrally aligned changes the format and
changes these cellular also on the currently active cell and to run it.
I have created a shortcut control shift a So here is some text if I need to perform these four operations
I will have to individually go to the options in the menu bar and click on those and for multiple tables
I would have to do it multiple times but if I executed my same macro by pressing control shift a.
All four actions will be done at once.
You can see the student's cell is now having great background.
It is centrally aligned.
It is bold and the font of this is no central exotic whereas the others have deformed Gallipoli.
I can also do this for other cells entering the top row and do this control shift a you can see this
has made my work very easy and this has the potential to save a lot of pain.
Basically automate all the repetitive parts of the Excel operations.
Now let us learn how to create these macros trusting we will need this.
This developer tab on the top if you can see this.
Great.
If you cannot read click anywhere on the menu idea.
And click on customize the ribbon.
Check this developer box if it is unchecked for you and then click on OK.
Now once you have this delivered tab click on it.
Here you can see the options of recording a macro.
So let us clear the small macro.
I wrote to my 60 second tune which is the excessive sheet.
It has different tables.
I will record a macro for one or two tables when I format this table and I'll use the macro to format
the other tables below.
So I go to the first set in this table which is the top left side.
I start the macro recording.
But before that I'll have to click on the use relative reference button below.
What this does is if I use absolute differences that is if I do not like this button always the macro
will run from the C6 cell which is currently selected but if I use relative references it will not start
from C 16.
It will start from the currently actresses so I go to the c section click on use and read the references
and start regarding my macro.
I'll give it a name of exercise macro charter remote control issue of s description is formatting a
table.
Okay so now the recording has started and you can see that button that seems to stop recording now to
select the top row of this table.
I'll use control shift right.
I add a border to this.
Then I'll borders and JT sell color to grey.
Similarly I'll then go to the store in one sale and I'll select the the whole table below.
And then I'd add borders to this
and I'll take border or plane.
And adopted a border
okay.
You can see we have the border now.
Now I will select these two the names and I will italicized them.
It.
Now our table is formatted.
We can go and stop recording now.
If I go to the festival table that I have low you can see that it has one less column and two more rules
than the previous table to accommodate this in our macro by.
We were recording this macro.
We used control shift right instead of selecting a particular number of cells.
So what control shift right does is it select all the cells in the top row instead.
If I would have selected the first six cells then I run the macro.
It will select only the first six cells only so since we use control shift energy.
When I run the macro on this table which has one left column and two more rules it will still work to
let us do it.
We'll use the shortcut control chief as you can see that a macro has successfully on a greater table
now there is another method to run this macro if we want to give this to someone else that someone else
will not know the shortcut to run the macro.
You can provide that other person with a better way to run this macro.
That is to insert a button to run any macro to insert a button.
You go to deliver tab insert option and let the button you draw the button here.
Saying the exercise macro to it.
Okay.
You can be named Bitcoin exercise macro
so whenever you will.
You want to formica table.
Go to the top left cell of that table and click on this button.
It will format that table for you.
Whenever you are saving a file with macros you have to go to file select Save As select a particular
folder.
But life saving you have to select the Excel macro in every workbook.
If you have selected a normal workbook and you click on Save Excel will give you a pop up that this
workbook contains macros.
We can try that.
Also so if I try to save this
you can see that Excel is giving a pop up that the following We just cannot receive in a macro field
workbook.
So you have to click Neuer select a macro and it will look good and civic
even the event this file will have a different extension than normal workbooks.
Not only does not excellence X but macro level work book it will be dot excellence and also I told you
in the beginning that macro is actually code.
So where can you see this code to see the code.
You can click on the visual basic but an indie developer tab
this is the VB window which stands for Visual Basic for applications and here in this module if you
expand it using the same level on module 1 you can see that it contains both macros.
Give us one example if you scroll down it will have the exercise macro if you understand coding just
go through this it is pretty easy to correlate the first few lines commented lines.
These do not run but this tells you something about the macro.
After that the macro runs which is selecting the range then making it ball giving it borders.
You can go from whatever is written it will not be covering the exact coding in visual basic instead
of remembering the code whenever you want to perform a particular action using coding just a a macro
look at core.
You can just copy paste the same code and use it for your own customized visual busy application that
of this letter and that's all for this cause.
Since you now know the basics of Excel you can visit our channel and look at some really interesting
use cases of Excel these maybe high level implementation of Excel but these are really fun and interesting.
Please visit our YouTube channel.
They started it and we thanks.